//
//  ViewController.m
//  ObserverPattern
//  
//  Created by ying on 2016/12/13.
//  Copyright © 2016年 ying. All rights reserved.
//

#import "ViewController.h"
#import "WYXCurrCondiDisplay.h"
#import "WYXWeatherData.h"

@interface ViewController ()
@property (nonatomic, strong) WYXCurrCondiDisplay *currDisplay;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    WYXWeatherData *weatData = [WYXWeatherData sharedWeatherData];
    WYXCurrCondiDisplay *display = [[WYXCurrCondiDisplay alloc] initWithWeatherData:weatData];
    self.currDisplay = display;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    NSLog(@"点击屏幕时停止展示！！");
    if (self.currDisplay) {
        [[WYXWeatherData sharedWeatherData] removeObserver:self.currDisplay];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
